package com.dps.omc.monitor;

/**
 * Created by lip on 2016-05-30.
 */
public class AgentState {

    public static final int NUM = 2;

    private String id; //代理ID
    private String ip;//代理IP
    private String name;//代理名称
    private int num = NUM;//失去连接数
    private boolean state = true;//是否在线

    public AgentState(String id,String ip,String name)
    {
        this.id = id;
        this.ip = ip;
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public boolean getState() {
        return state;
    }

    public void setState(boolean state) {
        this.state = state;
    }

    public void up()
    {
        this.num = NUM;
        this.state = true;
    }

    public void down()
    {
        if(--this.num<=0)
        {
            this.num = 0;
            this.state = false;
        }
    }
}
